<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>


<script>
    //数组去重
    let ary= [1,2,3,1,2,5,6,2,3,2,123,43,12,4];
    console.log(new Set(ary))
    console.log(...new Set(ary))
    let ary1= [1,2,3,1,2,5,6,2,3,2,123,43,12,4];
    console.log(Array.from(new Set(ary1)))


    let ary2=[1,3,5,7,8,9,10];
    let ary3=[2,4,6,7,8,9];

    //并集
    function add(ary2,ary3) {
        return [...new Set([...ary2,...ary3])]
    }
    console.log(add(ary2,ary3))

    //交集
    function same(ary2,ary3) {
        return ary2.filter(item=>ary3.includes(item))
    }
    console.log(same(ary2,ary3))




</script>
</body>
</html>